package com.hxgis.common.conare;

import com.hxgis.common.entity.RainstormInfo;
import com.hxgis.common.utils.TimeUtil;

import java.util.List;
import java.util.Objects;

/**
 * 国家暴雨组
 * @author cqj
 * @version 1.0
 * @date 2019/9/24 16:43
 */
public class NationGroup {

    //组的时间
    private Long time;

    //中心点
    private double[] centerPoint;

    //数据
    private List<RainstormInfo> rainstormInfos;

    //区域过程标识
    private String nationFlag;

    public NationGroup() {
    }

    public Long getTime() {
        return time;
    }

    public void setTime(Long time) {
        this.time = time;
    }

    public double[] getCenterPoint() {
        return centerPoint;
    }

    public void setCenterPoint(double[] centerPoint) {
        this.centerPoint = centerPoint;
    }

    public List<RainstormInfo> getRainstormInfos() {
        return rainstormInfos;
    }

    public void setRainstormInfos(List<RainstormInfo> rainstormInfos) {
        this.rainstormInfos = rainstormInfos;
    }

    public String getNationFlag() {
        return nationFlag;
    }

    public void setNationFlag(String nationFlag) {
        this.nationFlag = nationFlag;
    }

    /**
     * 校验时间
     * @param nationGroup
     * @return
     */
    public boolean checkTime(NationGroup nationGroup) {
        Long groupTime = nationGroup.getTime();
//        if (Math.abs((int)(groupTime - time)) == 1) return true;
        if (Objects.equals(TimeUtil.nextDay(String.valueOf(groupTime),1), String.valueOf(time))){
            return true;
        }
        if (Objects.equals(TimeUtil.nextDay(String.valueOf(time),1), String.valueOf(groupTime))){
            return true;
        }
        return false;
    }
}
